Image blurring methods and apparatuses, storage media, and electronic devices

ABSTRACT

Image blurring methods and apparatuses, storage media, and electronic devices can include: obtaining a main image and a secondary image obtained by photographing the same object with a dual-lens camera; obtaining depth data and depth confidence degree data according to the main image and the secondary image, the depth data indicating depth values of corresponding pixel points in the main image and the secondary image, and the depth confidence degree data indicating confidence degrees of the depth values in the depth data; correcting at least one depth value in the depth data according to the depth confidence degree data; and blurring the main image according to corrected depth data.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation application of International Patent ApplicationNo. PCT/CN2018/087372 filed on May 17, 2018, which claims priority toChinese Patent Application No. 201710359299.3 filed on May 19, 2017. Thedisclosures of these applications are incorporated herein by referencein their entirety.

BACKGROUND

Background blurring of images can enable photography subjects to bedisplayed clearly, and is popular with photography enthusiasts. For now,an image blurring effect is mainly achieved by using an optical imagingprinciple, i.e., using a large lens aperture for implementation onhardware. Therefore, the image blurring function is mainly integrated onprofessional cameras such as a single-lens reflex camera.

SUMMARY

Embodiments of the present disclosure relate to image processingtechnologies, and in particular, to image blurring methods andapparatuses, storage media, and electronic devices.

Embodiments of the present disclosure provide technical solutions ofimage blurring.

An image blurring method provided according to one aspect of theembodiments of the present disclosure includes: obtaining a main imageand a secondary image obtained by photographing a same object with adual-lens camera; obtaining, according to the main image and thesecondary image, depth data and depth confidence degree data, the depthdata indicating depth values of corresponding pixel points in the mainimage and the secondary image, and the depth confidence degree dataindicating confidence degrees of the depth values in the depth data;correcting, according to the depth confidence degree data, at least onedepth value in the depth data; and blurring, according to correcteddepth data, the main image.

An image blurring apparatus further provided according to another aspectof the embodiments of the present disclosure includes: a first obtainingmodule configured to obtain a main image and a secondary image obtainedby photographing a same object with a dual-lens camera; a secondobtaining module configured to obtain depth data and depth confidencedegree data according to the main image and the secondary image, thedepth data indicating depth values of corresponding pixel points in themain image and the secondary image, and the depth confidence degree dataindicating confidence degrees of the depth values in the depth data; acorrecting module configured to correct at least one depth value in thedepth data according to the depth confidence degree data; and a blurringmodule configured to blur the main image according to corrected depthdata.

A storage medium also provided according to still another aspect of theembodiments of the present disclosure stores at least one executableinstruction, where the executable instruction is adapted to be loaded bya processor and execute operations corresponding to the image blurringmethod according to any one of the foregoing embodiments.

An electrode device also provided according to yet another aspect of theembodiments of the present disclosure includes: a processor; and amemory for storing instructions executable by the processor; whereinexecution of the instructions by the processor causes the processor toperform operations corresponding to the image blurring method accordingto any one of the foregoing embodiments.

A computer program also provided according to yet another aspect of theembodiments of the present disclosure includes a computer-readable code,where when the computer-readable code runs in a device, a processor inthe device executes instructions for implementing the image blurringmethod according to any one of the foregoing embodiments.

According to the image blurring methods and apparatuses, the storagemedia, and the electronic devices of the embodiments of the presentdisclosure, the accuracy of depth data is effectively improved byobtaining the depth data and depth confidence degree data of a mainimage and a secondary image obtained by photographing the same objectwith a dual-lens camera and correcting the depth data by means of thedepth confidence degree data. On this basis, the blurring effect of themain image can be improved by blurring the main image by means of thecorrected depth data.

The following further describes in detail the technical solutions of thepresent disclosure with reference to the accompanying drawings andembodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings constituting a part of the specificationdescribe the embodiments of the present disclosure and are intended toexplain the principles of the present disclosure together with thedescriptions.

According to the following detailed descriptions, the present disclosurecan be understood more clearly with reference to the accompanyingdrawings.

FIG. 1 illustrates a flowchart of an image blurring method according toone embodiment of the present disclosure;

FIG. 2 illustrates a flowchart of an image blurring method according toanother embodiment of the present disclosure;

FIG. 3 illustrates a main image photographed by a dual-lens cameraprovided according to another embodiment of the present disclosure;

FIG. 4 illustrates a secondary image photographed by a dual-lens cameraprovided according to another embodiment of the present disclosure;

FIG. 5 illustrates a depth image of a main image provided according toanother embodiment of the present disclosure;

FIG. 6 illustrates a blurred main image provided according to anotherembodiment of the present disclosure;

FIG. 7 illustrates a logic block diagram of an image blurring apparatusaccording to one embodiment of the present disclosure;

FIG. 8 illustrates a logic block diagram of an image blurring apparatusaccording to another embodiment of the present disclosure;

FIG. 9 illustrates a logic block diagram of a blurring module of animage blurring apparatus according to another embodiment of the presentdisclosure; and

FIG. 10 illustrates a structural schematic diagram of an electronicdevice according to one embodiment of the present disclosure.

DETAILED DESCRIPTION

The implementations of the embodiments of the present disclosure arefurther described in detail below with reference to the accompanyingdrawings (the same reference numerals in a plurality of accompanyingdrawings represent the same elements) and the embodiments. The followingembodiments are intended to illustrate the present disclosure, but arenot intended to limit the scope of the present disclosure.

A person skilled in the art may understand that the terms such as“first” and “second” in the embodiments of the present disclosure areonly used to distinguish different operations, devices or modules, etc.,and do not represent any specific technical meaning or an inevitablelogical sequence therebetween.

In addition, it should be understood that, for ease of description, thesize of each part shown in the accompanying drawings is not drawn inactual proportion.

The following descriptions of various exemplary embodiments are merelyillustrative actually, and are not intended to limit the presentdisclosure and the applications or uses thereof.

Technologies, methods and devices known to a person of ordinary skill inthe related art may not be discussed in detail, but such technologies,methods and devices should be considered as a part of the specificationin appropriate situations.

It should be noted that similar reference numerals and letters in thefollowing accompanying drawings represent similar items. Therefore, oncean item is defined in an accompanying drawing, the item does not need tobe further discussed in the subsequent accompanying drawings.

The embodiments of the present disclosure may be applied to electronicdevices such as terminal devices, computer systems, and servers, whichmay operate with numerous other general-purpose or special-purposecomputing system environments or configurations. Examples of well-knownterminal devices, computing systems, environments, and/or configurationssuitable for use together with the electronic devices such as terminaldevices, computer systems, and servers include, but are not limited to,personal computer systems, server computer systems, thin clients, thickclients, handheld or laptop devices, microprocessor-based systems, settop boxes, programmable consumer electronics, network personalcomputers, small computer systems, large computer systems, distributedcloud computing environments that include any one of the foregoingsystems, and the like.

The electronic devices such as terminal devices, computer systems, andservers may be described in the general context of computer systemexecutable instructions (for example, program modules) executed by thecomputer systems. Generally, the program modules may include routines,programs, target programs, assemblies, logics, data structures, and thelike, to perform specific tasks or implement specific abstract datatypes. The computer systems/servers may be practiced in the distributedcloud computing environments in which tasks are performed by remoteprocessing devices that are linked through a communications network. Inthe distributed cloud computing environments, the program modules may belocated in local or remote computing system storage media includingstorage devices.

The inventors of the present application have recognized that, with theincreasing popularity of smart phones, most users use mobile phones totake photos. However, due to the limit of the thickness of a mobilephone, only the small-aperture lens can be installed in the mobilephone, and thus the mobile phone can only generate a weak blurringeffect in the case of a close distance, but no image with the blurringeffect can be generated in other scenes.

FIG. 1 is a flowchart of an image blurring method according to oneembodiment of the present disclosure.

Referring to FIG. 1, in operation S110, a main image and a secondaryimage obtained by photographing the same object with a dual-lens cameraare obtained.

The dual-lens camera can photograph the same scene at different anglesto obtain two pictures, i.e., the main image and the secondary image (ora left image and a right image), and which one of the two pictures isused as the main image and which one is used as the secondary image isdetermined in the way set before the dual-lens camera leaves thefactory. The dual-lens camera can be provided on a mobile smart terminalwhich cannot be integrated with a large-aperture lens due to the limitof the thickness, such as the dual-lens camera on a smart phone.

In the main image and the secondary image obtained by photographing thesame object with the dual-lens camera, the main image is the picturefinally presented to users. According to the image blurring method ofthe embodiments of the present disclosure, the main image photographedby the dual-lens camera is blurred to improve the blurring effect of themain image.

In an optional example, the operation S110 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a first obtaining module 310 run by theprocessor.

In operation S120, depth data and depth confidence degree data areobtained according to the main image and the secondary image, where thedepth data indicates depth values of corresponding pixel points in themain image and the secondary image, and the depth confidence degree dataindicates confidence degrees of the depth values in the depth data.

The depth confidence degree data indicates confidence degrees of thedepth values in the depth data and thus can represent the accuracy ofthe depth data, i.e., the accuracy of the depth values of the pixelpoints in the obtained main and secondary images can be separatelyrepresented by means of the depth confidence degree data of the main andsecondary images, where the depth vale is a distance from thephotographed objected corresponding to the pixel points in thephotographed picture (main image or secondary image) to the camera.

The way of obtaining the depth data and the depth confidence degree datais not defined in this embodiment. For example, during depth dataobtaining, the depth data of the main image and the secondary image canbe obtained by performing stereo matching on the main image and thesecondary image, or using other image processing technologies and a deepneural network to process the main image and the secondary image.However, no limitation is made thereto.

In an optional example, the operation S120 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a second obtaining module 320 run by theprocessor.

In operation S130, at least one depth value in the depth data iscorrected according to the depth confidence degree data.

For example, the depth value having a lower confidence degree in thedepth data of the main image is corrected according to the depthconfidence degree data of the main image, so that the depth value ofeach pixel point in the main image indicated by the depth data of themain image becomes more accurate.

In an optional example, the operation S130 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a correcting module 330 run by theprocessor.

In operation S140, the main image is blurred according to correcteddepth data.

According to one or more embodiments of the present disclosure, thedepth data of the main image is corrected according to the depthconfidence degree data of the main image, proposed blurring data forblurring and rendering is calculated according to the corrected depthdata of the main image, and the partial area in the main image isblurred or the pixel value of some pixel points in the main image isadjusted, so as to blur and render the main image. Since the depth dataof the main image can indicate the pixel values of the pixel points inthe main image more accurately after being corrected by means of thedepth confidence degree data, further performing blurring according tothe corrected depth data can effectively improve the blurring effect ofthe main image, thereby solving the problem that an image photographedby a dual-camera phone has no blurring effect or has a weak blurringeffect.

In an optional example, the operation 5140 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a blurring module 340 run by the processor.

According to the image blurring methods of the embodiments of thepresent disclosure, the accuracy of depth data is effectively improvedby obtaining the depth data and depth confidence degree data of a mainimage and a secondary image obtained by photographing the same objectwith a dual-lens camera and correcting the depth data by means of thedepth confidence degree data. On this basis, the blurring effect of themain image can be improved by blurring the main image by means of thecorrected depth data.

In practical applications, the image blurring method of this embodimentcan be implemented by a camera, image processing programs, or anintelligent terminal having a camera function, etc. However, a personskilled in the art should know that in practical applications, anydevice that has corresponding image processing and data processingfunctions can implement the image blurring method of the embodiments ofthe present disclosure with reference to this embodiment.

FIG. 2 is a flowchart of an image blurring method according to anotherembodiment of the present disclosure.

Referring to FIG. 2, in operation S210, a main image and a secondaryimage obtained by photographing the same object with a dual-lens cameraare obtained.

For example, the main image and the secondary image obtained in thisembodiment according to FIGS. 3 and 4. The main image and the secondaryimage are two pictures obtained by photographing the same scene by thedual-lens camera at different angles. It can be known from FIGS. 3 and 4that the positions of ears of toy dolls close to edges of the picturesin the main image and the secondary image are different (the positionsrelative to a mousepad on the top of a table are different).

In an optional example, the operation S210 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a first obtaining module 310 run by theprocessor.

In operation S220, depth data and depth confidence degree data areobtained according to the main image and the secondary image, where thedepth data indicates depth values of corresponding pixel points in themain image and the secondary image, and the depth confidence degree dataindicates confidence degrees of the depth values in the depth data.

In an optional implementation, initial depth data is obtained byperforming stereo matching on the main image and the secondary image.Furthermore, depth calibration is performed on the initial depth data toposition the corresponding pixel points of the main image and thesecondary image at the same depth so as to obtain the calibrated depthdata of the main image and the secondary image. Here, the initial depthdata can be rapidly and accurately obtained by means of stereo matching.By calibrating the initial depth data, in the case that thecorresponding pixel points of the main image and the secondary image arenot positioned at the same depth resulting from the dual-lens cameraslightly displacing or rotating due to factors such as collision, thecorresponding pixel points of the main image and the secondary image canbe positioned at the same depth, thereby preventing subsequent imageprocessing operations from being affected.

In this embodiment, after obtaining the depth data of the main image andthe secondary image, the depth confidence degree data of the main imageis also obtained. For example, if the corresponding pixel points in themain image and the secondary image have the same depth value, a depthconfidence degree value greater than a reference value is assigned toeach of the depth values of the corresponding pixel points, and if thecorresponding pixel points in the main image and the secondary imagehave different depth values, depth confidence degree values smaller thanthe reference value are assigned to the depth values of thecorresponding pixel points; and/or, if the depth value of the pixelpoints in the main image exceeds a preset range, a depth confidencedegree value smaller than the reference value is assigned to each of thepixel points of which the depth value exceeding the preset range, and ifthe depth value of the pixel points in the main image does not exceedthe preset range, a depth confidence degree value greater than thereference value is assigned to the depth value of the pixel points;and/or, if the pixel points in the main image have two or more depthvalues, a depth confidence degree value smaller than the reference valueis assigned to each of the depth values of the pixel points having twoor more depth values, and if the pixel points in the main image have thesame depth value, a depth confidence degree value greater than thereference value is assigned to the depth value of the correspondingpixel points.

According to one or more embodiments of the present disclosure, thedepth data and the depth confidence degree data are respectively a depthimage and a confidence degree image. For example, referring to the depthimage of the main image in FIG. 5, the value of each pixel point in thedepth image represents a depth value of a corresponding first pixelpoint in the main image. The value of each pixel point in thecorresponding depth confidence degree image (not shown) of the mainimage represents a confidence degree of the depth value of thecorresponding first pixel point. Here, the sizes of the depth image andthe confidence degree image of the main image are identical to the sizeof the main image.

In an optional example, the operation S220 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a second obtaining module 320 run by theprocessor.

In operation S230, at least one depth value in the depth data iscorrected according to the depth confidence degree data, and the depthdata is de-noised.

According to one or more embodiments of the present disclosure, if thedepth data of the main image is corrected according to the correspondingdepth confidence degree data of the main image, the depth value of apixel point having the minimum depth confidence degree value is replacedwith the depth value of a neighboring pixel point having the maximumdepth confidence degree value, so as to avoid a large error that mayoccur in the depth values determined for the pixel points in the mainimage, make the depth values indicated by the depth data more accurate,and improve the accuracy of the depth data.

In addition, in order to further improve the accuracy of the obtaineddepth data, the depth data can also be de-noised. According to one ormore embodiments of the present disclosure, the de-noising can includefiltering the depth data by using a filter, and/or, increasing the depthvalues in the depth data according to a preset proportion. For example,a smoothing filter is used so that the pixel points with similar colorsin the main image have similar depth values, and thus the accuracy ofthe depth data is further improved; and the depth values in the depthdata are stretched to increase the depth values in the depth dataaccording to the preset proportion to increase the contrast among thedepth values of the pixel points.

In an optional example, the operation S230 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a correcting module 330 and a de-noisingmodule 350 run by the processor.

In operation S240, a depth difference value between each first pixelpoint in the main image and a predetermined focusing point in the mainimage is determined according to the depth data.

In this embodiment, before the execution of the operation, focusingpoint information of the main image is obtained by means of inputting.According to one or more embodiments of the present disclosure, duringthe blurring of the photographed main image, a user can select and clicka point or area in the main image, or input coordinates or other data ofa point or area in the main image and use the point or area as afocusing point or focusing area of the main image. For example, if themain image includes a person and a vehicle, the user can click theperson as the focusing point; by implementing the image blurring methodof this embodiment, the person in the main image is displayed moreclearly, and the vehicle and other background areas in the main imageare displayed less clearly.

Certainly, in other embodiments, in the case that the user has selecteda focusing point when photographing the main image, information of thedetermined focusing points in the main image can also be directlyobtained during the execution of the operation, where the focusing pointselected by the user is a focusing point selected during autofocusing ofthe camera when the user photographs the main image.

The predetermined focusing point in the main image is determinedaccording to the obtained focusing point information; the depth valuesof each first pixel point and the predetermined focusing point in themain image are obtained according to the de-noised depth data; and adifference value between the depth values of each first pixel point andthe predetermined focusing point is calculated.

In an optional example, the operation S240 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a fourth obtaining unit 341 in the blurringmodule 340 run by the processor.

In operation S250, the blurring desired data of each first pixel pointis respectively determined according to each depth difference value.

In this embodiment, the blurring desired data of each first pixel pointis calculated according to the depth difference value between each firstpixel point in the main image and the predetermined focusing point, foruse to indicate a desired or proposed blurring degree of blurring eachfirst pixel point in the main image. Here, the blurring desired dataincludes, but is not limited to, a blurring radius length or diameterlength, etc., and the blurring diameter length may include, but is notlimited to, a radius, a diameter, or other information of a circle ofconfusion of the blurred pixels.

According to one or more embodiments of the present disclosure, theblurring desired data of a first pixel point includes the blurringradius. For example, the blurring radius c of a first pixel point iscalculated through a formula: c=A*abs(d0-d), where abs is an absolutevalue function, A is an aperture size of the simulated large-aperturelens, d0 is the depth value of the predetermined focusing point, and dis the depth value of the first pixel point.

When d is equal to d0, the first pixel point and the predeterminedfocusing point are at the same length, the blurring radius c is equal to0, and thus the first pixel point requires no blurring. When d is notequal to d0, the first pixel point is far away from the predeterminedfocusing point, and the closer the distance, the smaller the blurringradius c, and the further the distance, the greater the blurring radiusc. That is, in the main image, the predetermined focusing point is notblurred; during blurring, the blurring degree of a focusing areaneighboring to the predetermined focusing point is small; and duringblurring, the blurring degree of an area away from the predeterminedfocusing point is great, and the further the distance, the greater theblurring degree.

In an optional example, the operation S250 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a fourth obtaining unit 341 in the blurringmodule 340 run by the processor.

In operation S260, the main image is blurred according to the blurringdesired data of each first pixel point.

In an optional implementation, a method for blurring and rendering themain image according to the obtained blurring desired data includes:generating a blurred image of which a pixel point corresponds to thefirst pixel point of the maim image and a pixel value is an initialvalue; respectively determining an initial blurring weight value of acorresponding second pixel point in the blurred image according to theblurring desired data of each first pixel point in the main image;performing at least one update on at least one second pixel point in theblurred image, the update including: updating, according to a pixelvalue of a first pixel point and a current blurring weight value of asecond pixel point corresponding to the first pixel point, a currentpixel value and a current blurring weight value of at least oneneighboring second pixel point of the corresponding second pixel point;and obtaining a blurring result of the main image according to theupdated blurred image.

According to one or more embodiments of the present disclosure, duringthe generating of the blurred image, a blurred image having the samesize as the main image and pixel points in one-to-one correspondence tothe first pixel points in the main image is generated, and the pixelvalue of each second pixel point in the blurred image is initialized as0 (or a certain identical value). Here, both the first pixel points andthe second pixel points can be represented by coordinates (x, y) becausethe main image and the blurred image have equal size and the first pixelpoints and the second pixel points have one-to-one correspondence. Itshould be noted here that in practical applications, the blurred imageof the main image can also be generated before the execution of theoperations S210 to S250 to obtain the blurring desired data of the mainimage.

In this embodiment, an initial blurring weight value of each secondpixel point in the blurred image is obtained according to the blurringdesired data, for use to simulate a blurring process of a lens having alarge aperture (such as a single-lens reflex camera) during imaging toblur and render the main image. According to one or more embodiments ofthe present disclosure, the blurring desired data includes the blurringradius, and during the obtaining of the initial blurring weight value,respective initial blurring weight values w(x, y) are respectivelydetermined for the second pixel points (x, y) in the blurred imageaccording to a formula: w(x, y)=1/c(x, y)2, where c(x, y) is theblurring radius of a first pixel point (x, y). That is, the greater theblurring radius of the first pixel point, the smaller the initialblurring weight value of the corresponding second pixel point.

According to one or more embodiments of the present disclosure, adistance between the neighboring second pixel point and thecorresponding second pixel point meets a set requirement. For example,the set requirement is that the distance is smaller than or equal to theblurring radius, i.e., the blurring radius of the first pixel point isgreater than the distance between the corresponding second pixel pointand the neighboring second pixel points.

During the updating of the second pixel points in the blurred image, ascattering operation for each second pixel point (x, y) in the blurredimage is performed on multiple neighboring second pixel points (x′, y′),so as to update a current pixel value I(x′, y′) and a current blurringweight value w(x′, y′). For example, new I(x′, y′) is obtained byaccumulating I(x′, y′)*w(x, y) on the basis of I(x′, y′), to update thecurrent pixel value once; and new w(x′, y′) is obtained by accumulatingw(x, y) on the basis of w(x′, y′), to update the current blurring weightvalue once.

The blurred image is updated by continuously updating the current pixelvalue and the current blurring weight value of each second pixel pointuntil all the second pixel points are updated.

According to one or more embodiments of the present disclosure, thepixel value of each second pixel point in the blurred image isnormalized according to a current pixel value and a current blurringweight value of each second pixel point in the updated blurred image,and the normalized blurred image is used as the blurring result.

In this embodiment, the current pixel value of each second pixel pointis normalized according to the updated current pixel value and currentblurring weight value of each second pixel point, so as to obtain thepixel value of each second pixel point. That is, the pixel value of asecond pixel point is the ratio of the updated current pixel value tothe updated current blurring weight value. Each obtained pixel value isdetermined as the pixel value of each second pixel point in the blurredimage, and the processed blurred image is determined as the blurringresult of the main image.

In an optional example, the operation S260 may be performed by aprocessor by invoking a corresponding instruction stored in a memory,and may also be performed by a blurring unit in the blurring module 340run by the processor.

Referring to the blurred main image in FIG. 6, the blurred main imagehas an obvious blurring effect. The focusing area (the focusing area isthe face area of the toy doll at the left side) in FIG. 6 is not blurredor has a small blurring degree, and thus can be clearly displayed; andas the distance increases, the blurring degrees of the pixel pointsdistant from the focusing area become greater and greater, and the pixelpoints are thus displayed more and more blurrily.

According to the image blurring methods of the embodiments of thepresent disclosure, the accuracy of depth data is effectively improvedby obtaining the depth data and depth confidence degree data of a mainimage and a secondary image obtained by photographing the same objectwith a dual-lens camera, correcting the depth data by means of the depthconfidence degree data, and de-noising the depth data. On this basis,the blurring effect of the main image can be improved by blurring themain image by means of the corrected depth data. Moreover, during theblurring, the main image is blurred and rendered by simulating theblurring process of a large-aperture lens, so that the main image has anobvious blurring effect.

In practical applications, the image blurring method of this embodimentcan be implemented by a camera, image processing programs, or anintelligent terminal having a camera function, etc. However, a personskilled in the art should know that in practical applications, anydevice that has corresponding image processing and data processingfunctions can implement the image blurring method of the embodiments ofthe present disclosure with reference to this embodiment.

Alternatively, any image blurring method provided in the embodiments ofthe present disclosure may be executed by a processor, for example, anyimage blurring method mentioned in the embodiments of the presentdisclosure is executed by the processor by invoking correspondinginstructions stored in a memory. Details are not described below again.

A person of ordinary skill in the art may understand that all or someoperations of implementing the forgoing embodiments of the method may beachieved by a program by instructing related hardware; the program canbe stored in a computer readable storage medium; when the program isexecuted, operations including the foregoing embodiments of the methodare executed. Moreover, the storage medium includes at least one mediumcapable of storing program code, such as ROM, RAM, a magnetic disk, oran optical disk.

FIG. 7 is a logic block diagram of an image blurring apparatus accordingto one embodiment of the present disclosure. A person skilled in the artcan understand that the term “module” or “unit” in the embodiments ofthe present disclosure may separately refer to a software module or unitsuch as “a program module” or “a program unit”, and may also separatelyrefer to a module or unit formed by hardware, firmware, or any form ofsoftware, hardware, and firmware. No limitation is made thereto in theembodiments of the present disclosure. Details are not described belowagain.

Referring to FIG. 7, the image blurring apparatus of this embodimentincludes a first obtaining module 310, a second obtaining module 320, acorrecting module 330, and a blurring module 340.

The first obtaining module 310 is configured to obtain a main image anda secondary image obtained by photographing the same object with adual-lens camera; the second obtaining module 320 is configured toobtain depth data and depth confidence degree data according to the mainimage and the secondary image, the depth data indicating depth values ofcorresponding pixel points in the main image and the secondary image,and the depth confidence degree data indicating confidence degrees ofthe depth values in the depth data; the correcting module 330 isconfigured to correct at least one depth value in the depth dataaccording to the depth confidence degree data; and the blurring module340 is configured to blur the main image according to corrected depthdata.

The image blurring apparatus of this embodiment is configured toimplement the corresponding image blurring method in the forgoing methodembodiments, and has the beneficial effects of the corresponding methodembodiments. Details are not described below again.

FIG. 8 is a logic block diagram of an image blurring apparatus accordingto another embodiment of the present disclosure.

According to the image blurring apparatus of this embodiment, the secondobtaining module 320 includes a first obtaining unit 323 configured to,if the corresponding pixel points in the main image and the secondaryimage have the same depth value, assign a depth confidence degree valuegreater than a reference value to each of the corresponding pixelpoints; and/or, if the depth value of the pixel points in the main imageexceeds a preset range, assign a depth confidence degree value smallerthan the reference value to each of the pixel points of which the depthvalue exceeding the preset range; and/or, if the pixel points in themain image have two or more depth values, assign a depth confidencedegree value smaller than the reference value to each of the pixelpoints having two or more depth values.

According to one or more embodiments of the present disclosure, thecorrecting module 330 is configured to replace the depth value of apixel point having the minimum depth confidence degree value with thedepth value of a neighboring pixel point having the maximum depthconfidence degree value.

According to one or more embodiments of the present disclosure, theimage blurring apparatus of this embodiment further includes: ade-noising module 350 configured to de-noise the depth data.

According to one or more embodiments of the present disclosure, thede-noising module 350 includes: a filtering unit 352 configured tofilter the depth data by using a filter; and/or, an increasing unit 351configured to increase the depth values in the depth data according to apreset proportion.

According to one or more embodiments of the present disclosure, thesecond obtaining module 320 includes: a second obtaining unit 321configured to perform stereo matching on the main image and thesecondary image to obtain initial depth data; and a third obtaining unit322 configured to perform depth calibration on the initial depth data toposition the corresponding pixel points of the main image and thesecondary image at the same depth to obtain the depth data.

According to one or more embodiments of the present disclosure, theblurring module 340 includes: a fourth obtaining unit 341 configured toobtain blurring desired data of each first pixel point in the main imageaccording to the corrected depth data; and a blurring unit 342configured to blur the main image according to the blurring desired dataof each first pixel point.

In an optional implementation, referring to FIG. 9, the blurring unit342 includes: a generating sub-unit 3421 configured to generate ablurred image of which a pixel point corresponds to the first pixelpoint of the maim image and a pixel value is an initial value; adetermining sub-unit 3422 configured to respectively determine aninitial blurring weight value of a corresponding second pixel point inthe blurred image according to the blurring desired data of each firstpixel point in the main image; an updating sub-unit 3423 configured toperform at least one update on at least one second pixel point in theblurred image, the update including: updating, according to a pixelvalue of a first pixel point and a current blurring weight value of asecond pixel point corresponding to the first pixel point, a currentpixel value and a current blurring weight value of at least oneneighboring second pixel point of the corresponding second pixel point;and a blurring sub-unit 3424 configured to obtain a blurring result ofthe main image according to the updated blurred image.

According to one or more embodiments of the present disclosure, adistance between the neighboring second pixel point and thecorresponding second pixel point meets a set requirement.

According to one or more embodiments of the present disclosure, theblurring desired data of the first pixel point includes: a blurringradius; and a distance between the neighboring second pixel point andthe corresponding second pixel point meeting a set requirement includes:the distance between the neighboring second pixel point and thecorresponding second pixel point is smaller than or equal to theblurring radius.

According to one or more embodiments of the present disclosure, theblurring sub-unit 3424 is configured to normalize the pixel value ofeach second pixel point in the blurred image according to a currentpixel value and a current blurring weight value of each second pixelpoint in the updated blurred image, and use the normalized blurred imageas the blurring result.

According to one or more embodiments of the present disclosure, thefourth obtaining unit 341 includes: a first determining sub-unit 3411configured to determine a depth difference value between each firstpixel point in the main image and a predetermined focusing point in themain image according to the depth data; and a second determiningsub-unit 3412 configured to respectively determine the blurring desireddata of each first pixel point according to each depth difference value.

According to one or more embodiments of the present disclosure, thefourth obtaining unit 341 further includes: an obtaining sub-unit 3413configured to obtain input focusing point information.

The image blurring apparatus of this embodiment is configured toimplement the corresponding image blurring method in the forgoing methodembodiments, and has the beneficial effects of the corresponding methodembodiments. Details are not described below again.

The embodiments of the present disclosure further provide an electronicdevice which, for example, may be a mobile terminal, a Personal Computer(PC), a tablet computer, a server, and the like. Referring to FIG. 10below, a schematic structural diagram of an electronic device 500adapted to implement a terminal device or a server according to theembodiments of the present disclosure is shown.

As shown in FIG. 10, the electronic device 500 includes one or moreprocessors, a communication element, and the like. The one or moreprocessors are, for example, one or more Central Processing Units (CPUs)501 and/or one or more Graphic Processing Units (GPUs) 513, and theprocessors may execute an appropriate action and processing according toan executable instruction stored in a Read-Only Memory (ROM) 502 or anexecutable instruction loaded from a storage section 508 to a RandomAccess Memory (RAM) 503. The communication element includes acommunication component 512 and a communication interface 509. Thecommunication component 512 may include, but is not limited to, anetwork card. The network card may include, but is not limited to, anInfiniBand (IB) network card. The communication interface 509 includes acommunication interface of a network interface card such as an LAN cardand a modem, and the communication interface 509 performs communicationprocessing via a network such as the Internet.

The processors may communicate with the ROM 502 and/or the RAM 503 toexecute the executable instruction, and may be connected to thecommunication component 512 by means of a bus 504 and thus communicatewith other target devices by means of the communication component 512,so as to complete the corresponding operations of any method provided bythe embodiments of the present disclosure, for example, obtaining a mainimage and a secondary image obtained by photographing the same objectwith a dual-lens camera, obtaining depth data and depth confidencedegree data according to the main image and the secondary image, thedepth data indicating depth values of corresponding pixel points in themain image and the secondary image, and the depth confidence degree dataindicating confidence degrees of the depth values in the depth data,correcting at least one depth value in the depth data according to thedepth confidence degree data, and blurring the main image according tocorrected depth data.

In addition, the RAM 503 may further store various programs and datarequired for operations of an apparatus. The CPU 501, the ROM 502, andthe RAM 503 are connected to each other via the bus 504. In the presenceof the RAM 503, the ROM 502 is an optional module. The RAM 503 storesexecutable instructions, or writes the executable instructions into theROM 502 during running, where the executable instructions cause the CPU501 to execute corresponding operations of the foregoing communicationmethod. An Input/Output (I/O) interface 505 is also connected to the bus504. The communication component 512 may be integrated, or may beconfigured to have a plurality of sub-modules (for example, a pluralityof IB network cards) linked on the bus.

The following parts are connected to the I/O interface 505: an inputsection 506 including a keyboard, a mouse and the like; an outputsection 507 including a Cathode-Ray Tube (CRT), a Liquid Crystal Display(LCD), a loudspeaker and the like; a storage section 508 includinghardware and the like; and the communication interface 509 of a networkinterface card including an LAN card, a modem and the like. A drive 510is also connected to the I/O interface 505 according to requirements. Aremovable medium 511 such as a magnetic disk, an optical disk, amagneto-optical disk, a semiconductor memory or the like is mounted onthe drive 510 according to requirements, so that a computer program readfrom the removable medium is installed on the storage section 508according to requirements.

It should be noted that the architecture illustrated in FIG. 10 ismerely an optional implementation. During practice, the number and typesof the parts in FIG. 10 may be selected, decreased, increased, orreplaced according to actual requirements. Different functional partsmay be separated or integrated or the like. For example, the GPU 513 andthe CPU 501 may be separated, or the GPU 513 may be integrated on theCPU 501, and the communication component 512 may be separated from orintegrated on the CPU 501 or the GPU 513 or the like. These alternativeimplementations all fall within the scope of protection of the presentdisclosure.

Particularly, the process described above with reference to theflowchart according to the embodiments of the present disclosure isimplemented as a computer software program. For example, the embodimentsof the present disclosure include a computer program product, includinga computer program tangibly included on a machine readable medium. Thecomputer program includes program codes for executing the method shownin the flowchart. The program codes may include correspondinginstructions for correspondingly executing the operations of the methodprovided in the embodiments of the present disclosure, for example,obtaining a main image and a secondary image obtained by photographingthe same object with a dual-lens camera, obtaining depth data and depthconfidence degree data according to the main image and the secondaryimage, the depth data indicating depth values of corresponding pixelpoints in the main image and the secondary image, and the depthconfidence degree data indicating confidence degrees of the depth valuesin the depth data, correcting at least one depth value in the depth dataaccording to the depth confidence degree data, and blurring the mainimage according to corrected depth data. In such embodiments, thecomputer program may be downloaded from a network by means of thecommunication element and installed, and/or be installed from theremovable medium 511. The computer program, when being executed by theCPU 501, executes the foregoing functions defined in the method of theembodiments of the present disclosure.

The embodiments in the description are all described in a progressivemanner, for same or similar parts in the embodiments, refer to theseembodiments, and each embodiment focuses on a difference from otherembodiments. The system embodiments correspond to the method embodimentssubstantially and therefore are only described briefly, and for theassociated part, refer to the descriptions of the method embodiments.

The methods, apparatuses, and devices in the present disclosure areimplemented in many manners. For example, the methods, apparatuses, anddevices in the present disclosure are implemented with software,hardware, firmware, or any combination of software, hardware, andfirmware. The foregoing sequence of the operations of the method ismerely for description, and unless otherwise stated particularly, theoperations of the method in the present disclosure are not limited tothe described sequence. In addition, in some embodiments, the presentdisclosure is also implemented as programs recorded in a recordingmedium. The programs include machine-readable instructions forimplementing the methods according to the present disclosure. Therefore,the present disclosure further covers the recording medium storing theprograms for performing the methods according to the present disclosure.

The descriptions of the present disclosure are provided for the purposeof examples and description, and are not intended to be exhaustive orlimit the present disclosure to the disclosed form. Many modificationsand changes are obvious to a person of ordinary skill in the art. Theembodiments are selected and described to better describe a principleand an actual application of the present disclosure, and to make aperson of ordinary skill in the art understand the present disclosure,so as to design various embodiments with various modificationsapplicable to particular use.

The descriptions above only involve implementations of the embodimentsof the present disclosure. However, the scope of protection of theembodiments of the present disclosure is not limited thereto. Within thetechnical scope disclosed by the embodiments of the present disclosure,any variation or substitution that can be easily conceived of by personsskilled in the art should all be included within the scope of protectionof the embodiments of the present disclosure. Therefore, the scope ofprotection of the embodiments of the present disclosure should bedefined by the scope of protection of the claims.

1. An image blurring method, comprising: obtaining a main image and a secondary image obtained by photographing a same object with a dual-lens camera; obtaining, according to the main image and the secondary image, depth data and depth confidence degree data, the depth data indicating depth values of corresponding pixel points in the main image and the secondary image, and the depth confidence degree data indicating confidence degrees of the depth values in the depth data; correcting, according to the depth confidence degree data, at least one depth value in the depth data; and blurring, according to corrected depth data, the main image.
 2. The method according to claim 1, wherein the obtaining, according to the main image and the secondary image, the depth confidence degree data comprises at least one of the following operations: in response to the corresponding pixel points in the main image and the secondary image have the same depth value, assigning a depth confidence degree value greater than a reference value to each of the corresponding pixel points; in response to the depth value of the pixel points in the main image exceeds a preset range, assigning a depth confidence degree value smaller than the reference value to each of the pixel points of which the depth value exceeding the preset range; or, in response to the pixel points in the main image have two or more depth values, assigning a depth confidence degree value smaller than the reference value to each of the pixel points having two or more depth values.
 3. The method according to claim 1, wherein the correcting, according to the depth confidence degree data, at least one depth value in the depth data comprises: replacing a depth value of a pixel point having the minimum depth confidence degree value with a depth value of a neighboring pixel point having the maximum depth confidence degree value.
 4. The method according to claim 1, before the blurring, according to corrected depth data, the main image, further comprising: de-noising the depth data.
 5. The method according to claim 4, wherein the de-noising comprises: filtering the depth data by using a filter; and/or, increasing the depth values in the depth data according to a preset proportion.
 6. The method according to claim 1, wherein the obtaining, according to the main image and the secondary image, the depth data comprises: performing stereo matching on the main image and the secondary image to obtain initial depth data; and performing depth calibration on the initial depth data to position the corresponding pixel points of the main image and the secondary image at the same depth to obtain the depth data.
 7. The method according to claim 1, wherein the blurring, according to corrected depth data, the main image comprises: obtaining, according to the corrected depth data, blurring desired data of each first pixel point in the main image; and blurring, according to the blurring desired data of each first pixel point, the main image.
 8. The method according to claim 7, wherein the blurring, according to the blurring desired data of each first pixel point, the main image comprises: generating a blurred image of which a pixel point corresponds to the first pixel point of the main image and a pixel value is an initial value; respectively determining an initial blurring weight value of a corresponding second pixel point in the blurred image according to the blurring desired data of each first pixel point in the main image; performing at least one update on at least one second pixel point in the blurred image, the update comprising: updating, according to a pixel value of a first pixel point and a current blurring weight value of a second pixel point corresponding to the first pixel point, a current pixel value and a current blurring weight value of at least one neighboring second pixel point of the corresponding second pixel point; and obtaining, according to the updated blurred image, a blurring result of the main image.
 9. The method according to claim 8, wherein a distance between the neighboring second pixel point and the corresponding second pixel point meets a set requirement.
 10. The method according to claim 9, wherein a distance between the neighboring second pixel point and the corresponding second pixel point meets a set requirement, wherein the blurring desired data of the first pixel point comprises: a blurring radius; and a distance between the neighboring second pixel point and the corresponding second pixel point meeting a set requirement comprises: the distance between the neighboring second pixel point and the corresponding second pixel point is smaller than or equal to the blurring radius.
 11. The method according to claim 8, wherein the obtaining, according to the updated blurred image, a blurring result of the main image comprises: normalizing, according to a current pixel value and a current blurring weight value of each second pixel point in the updated blurred image, the pixel value of each second pixel point in the blurred image, and using the normalized blurred image as the blurring result.
 12. The method according to claim 7, before the obtaining, according to the corrected depth data, blurring desired data of each first pixel point in the main image, further comprising: obtaining input focusing point information; wherein the obtaining, according to the corrected depth data, blurring desired data of each first pixel point in the main image comprises: determining, according to the depth data, a depth difference value between each first pixel point in the main image and a predetermined focusing point in the main image; and respectively determining the blurring desired data of each first pixel point according to each depth difference value.
 13. The method according to claim 12, before the obtaining blurring desired data of each first pixel point in the main image according to the corrected depth data, further comprising: obtaining input focusing point information.
 14. An electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein execution of the instructions by the processor causes the processor to perform: obtaining a main image and a secondary image obtained by photographing a same object with a dual-lens camera; obtaining, according to the main image and the secondary image, depth data and depth confidence degree data, the depth data indicating depth values of corresponding pixel points in the main image and the secondary image, and the depth confidence degree data indicating confidence degrees of the depth values in the depth data; correcting, according to the depth confidence degree data, at least one depth value in the depth data; and blurring, according to corrected depth data, the main image.
 15. The electronic device according to claim 14, wherein the obtaining, according to the main image and the secondary image, the depth confidence degree data comprises at least one of the following operations: in response to the corresponding pixel points in the main image and the secondary image have the same depth value, assigning a depth confidence degree value greater than a reference value to each of the corresponding pixel points; in response to the depth value of the pixel points in the main image exceeds a preset range, assigning a depth confidence degree value smaller than the reference value to each of the pixel points of which the depth value exceeding the preset range; or, in response to the pixel points in the main image have two or more depth values, assigning a depth confidence degree value smaller than the reference value to each of the pixel points having two or more depth values.
 16. The electronic device according to claim 14, before the blurring, according to corrected depth data, the main image, further comprising: de-noising the depth data, wherein the de-noising comprises at least one of the following operations: filtering the depth data by using a filter; or, increasing the depth values in the depth data according to a preset proportion.
 17. The electronic device according claim 14, wherein the obtaining, according to the main image and the secondary image, the depth data comprises: performing stereo matching on the main image and the secondary image to obtain initial depth data; and performing depth calibration on the initial depth data to position the corresponding pixel points of the main image and the secondary image at the same depth to obtain the depth data.
 18. The electronic device according to claim 14, wherein the blurring, according to corrected depth data, the main image comprises: obtaining, according to the corrected depth data, blurring desired data of each first pixel point in the main image; and blurring, according to the blurring desired data of each first pixel point, the main image.
 19. The electronic device according to claim 18, wherein the blurring, according to the blurring desired data of each first pixel point, the main image comprises: generating a blurred image of which a pixel point corresponds to the first pixel point of the main image and a pixel value is an initial value; respectively determining an initial blurring weight value of a corresponding second pixel point in the blurred image according to the blurring desired data of each first pixel point in the main image; performing at least one update on at least one second pixel point in the blurred image, the update comprising: updating, according to a pixel value of a first pixel point and a current blurring weight value of a second pixel point corresponding to the first pixel point, a current pixel value and a current blurring weight value of at least one neighboring second pixel point of the corresponding second pixel point; and obtaining, according to the updated blurred image, a blurring result of the main image.
 20. A non-transitory computer-readable storage medium, configured to store computer-readable instructions, wherein execution of the instructions by the processor causes the processor to perform: obtaining a main image and a secondary image obtained by photographing a same object with a dual-lens camera; obtaining, according to the main image and the secondary image, depth data and depth confidence degree data, the depth data indicating depth values of corresponding pixel points in the main image and the secondary image, and the depth confidence degree data indicating confidence degrees of the depth values in the depth data; correcting, according to the depth confidence degree data, at least one depth value in the depth data; and blurring, according to corrected depth data, the main image. 